#ifndef _MQSERVER_H_
#define _MQSERVER_H_

#include <string>

namespace smq
{
  //! simple message queue server
  class MQServer
  {
  public:
    //! get server's instance
    /*! \return server's instance
      */
    static MQServer& Inst();

    //! free server's instance
    static void FreeInst();

    //! start simple message queue server
    /*! \param sServerHost - local interface bind to
        \param ushServerPort - server port
        \param nMaxQueue - max number of client sockets waiting for accept
      */
    void Start(const std::string& sServerHost, unsigned short ushServerPort, int nMaxQueue);

    //! stop server
    void Stop();

  protected:
    MQServer();
    ~MQServer();

  private:
    struct MQServerImpl;
    MQServerImpl* m_pImpl;
    static MQServer* m_pInst;
    friend struct MQServerImpl;
  };
}

#endif // _MQSERVER_H_
